package drds.binlog.server;

import drds.binlog.common.position.ClientInfo;
import drds.binlog.protocol.Message;
import drds.binlog.server.exception.BinlogServerException;

import java.util.concurrent.TimeUnit;

public interface Service
{

    void subscribe(ClientInfo clientInfo) throws BinlogServerException;

    void unsubscribe(ClientInfo clientInfo) throws BinlogServerException;

    //
    Message getWithAutoAck(ClientInfo clientInfo, int batchSize) throws BinlogServerException;

    Message getWithAutoAck(ClientInfo clientInfo, int batchSize, Long timeout, TimeUnit timeUnit) throws BinlogServerException;

    //
    Message getWithoutAck(ClientInfo clientInfo, int batchSize) throws BinlogServerException;

    Message getWithoutAck(ClientInfo clientInfo, int batchSize, Long timeout, TimeUnit timeUnit) throws BinlogServerException;

    //
    void ack(ClientInfo clientInfo, long batchId) throws BinlogServerException;

    //
    void rollback(ClientInfo clientInfo) throws BinlogServerException;

    void rollback(ClientInfo clientInfo, Long batchId) throws BinlogServerException;
}
